import React from 'react'
import _ from 'underscore'
import format from 'lib/util/format'
import GridWidget from 'lib/components/GridWidget.jsx'
import moment from 'moment'

export default class ListTable extends GridWidget {
  constructor(props){
    super(props)
  }
}

ListTable.defaultProps = _.extend({}, GridWidget.defaultProps, {
  extraClassName: 'table table-striped',
  oddColor: true,
  cols: [
    {
      title: '页面名称',
      key: 'name',
      sortable: true,
      render: (cellValue, rowValue) => {
        return (<a className="link-in-list" href={'#/' + rowValue.nameId}>{cellValue}</a>);
      }
    },
    {
      title: '平均流畅度',
      key: 'avg',
      sortable: true
    },
    {
      title: '最小流畅度',
      key: 'sm',
      sortable: true
    },
    {
      title: '发生次数',
      key: 'count',
      sortable: true
    },
    {
      title: '最近发生时间',
      key: 'lastTime',
      sortable: true,
      formatter: (v) => {
        return moment(v).format('YYYY-MM-DD HH:mm:ss')
      }
    }
  ]
});
